'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller: { home, user } } = app;
  const localStrategy = app.passport.authenticate('local', { successRedirect: '/api/user/info' });
  router.get('/', home.index);
  router.get('/api/user/info', user.info);
  router.post('/api/user/register', user.register);
  router.post('/api/user/login', localStrategy);
  router.post('/api/user/logout', user.logout);
};
